Skip to content

feat: extract theme provider#386

Open
harry-whorlow wants to merge 4 commits intomainfrom
extract-theme-provider
Open

feat: extract theme provider#386
harry-whorlow wants to merge 4 commits intomainfrom
extract-theme-provider

Conversation

@harry-whorlow
Copy link
Collaborator

@harry-whorlow harry-whorlow commented Mar 12, 2026

Moves theme provider out of utils. Currently a mismatch of devtools and devtools utils will result in breaking an application. Relocating the theme provider to the respective devtools will stop these errors.

Summary by CodeRabbit

  • Chores

    • Bumped package versions: devtools-utils (minor) and devtools-ui (patch)
  • Refactor

    • Public theme type renamed to TanStackDevtoolsTheme and exported from the UI package
    • Theme typing unified across packages and plugin props now use the new theme type
    • Styling helpers now require an explicit theme and components no longer auto-wrap with an internal theme provider
  • New Features

    • Additional icon components re-enabled and available for use

@changeset-bot
Copy link

changeset-bot bot commented Mar 12, 2026

🦋 Changeset detected

Latest commit: 76f237b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@tanstack/devtools-utils Minor
@tanstack/devtools-ui Patch
@tanstack/devtools-a11y Patch
@tanstack/devtools Patch
@tanstack/preact-devtools Patch
@tanstack/react-devtools Patch
@tanstack/solid-devtools Patch
@tanstack/vue-devtools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nx-cloud
Copy link

nx-cloud bot commented Mar 12, 2026

View your CI Pipeline Execution ↗ for commit 76f237b

Command Status Duration Result
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 1m 54s View ↗
nx run-many --targets=build --exclude=examples/** ✅ Succeeded 31s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-14 21:00:26 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 12, 2026

More templates

@tanstack/devtools

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools@386

@tanstack/devtools-a11y

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-a11y@386

@tanstack/devtools-client

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-client@386

@tanstack/devtools-ui

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-ui@386

@tanstack/devtools-utils

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-utils@386

@tanstack/devtools-vite

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-vite@386

@tanstack/devtools-event-bus

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-event-bus@386

@tanstack/devtools-event-client

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-event-client@386

@tanstack/preact-devtools

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/preact-devtools@386

@tanstack/react-devtools

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/react-devtools@386

@tanstack/solid-devtools

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/solid-devtools@386

@tanstack/vue-devtools

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/vue-devtools@386

commit: 76f237b

@harry-whorlow harry-whorlow marked this pull request as draft March 12, 2026 21:55
@harry-whorlow harry-whorlow force-pushed the extract-theme-provider branch from b0fb67b to 8048d9d Compare March 12, 2026 21:55
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2f62e3de-aa17-4803-881f-6b3afb81fe9d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Renames the exported Theme type to TanStackDevtoolsTheme, re-exports it from devtools-ui, updates consuming types across packages, removes the ThemeProvider wrapper from the lazy mount implementation, and adds a changeset bumping package versions.

Changes

Cohort / File(s) Summary
Changeset
.changeset/cyan-times-marry.md
Adds a changeset bumping @tanstack/devtools-utils (minor) and @tanstack/devtools-ui (patch); documents extracting devtools-ui to avoid theme mismatches.
devtools-ui: theme, styles, index & icons
packages/devtools-ui/src/components/theme.tsx, packages/devtools-ui/src/index.ts, packages/devtools-ui/src/styles/use-styles.ts, packages/devtools-ui/src/components/icons.tsx
Renames exported ThemeTanStackDevtoolsTheme, updates ThemeContext types and provider props, requires explicit theme in styles factory, re-exports the new type from the UI index, and adjusts icon component prop typings (several icons re-enabled).
devtools-utils: mount impl & package.json
packages/devtools-utils/src/solid/class-mount-impl.tsx, packages/devtools-utils/package.json
Removes ThemeProvider wrapper from the lazy mount render path and drops local @tanstack/devtools-ui dependency from package.json.
Consumers: core packages, examples & a11y
packages/devtools/src/context/devtools-context.tsx, packages/devtools/src/context/devtools-store.ts, packages/preact-devtools/src/devtools.tsx, packages/react-devtools/src/devtools.tsx, packages/solid-devtools/src/core.tsx, packages/devtools-a11y/src/core/styles/styles.ts, examples/solid/devtools-ui/src/index.tsx
Updates consumer typings to use TanStackDevtoolsTheme instead of `'light'

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐇
I hopped through types with nimble feet,
Pulled the theme apart to keep things neat,
No provider cloak, the component’s bare,
Hooray for tidy types and lighter air! 🥕✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description explains the motivation but lacks the required template structure with dedicated sections for Changes and Checklist confirmation. Follow the repository's PR template by adding proper sections: 🎯 Changes section with detailed changes, and ✅ Checklist with marked items confirming testing and changeset.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: extract theme provider' accurately summarizes the main change: extracting/moving the theme provider from utils to devtools packages.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch extract-theme-provider
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@harry-whorlow harry-whorlow marked this pull request as ready for review March 13, 2026 09:18
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/devtools-utils/src/solid/class.ts (1)

26-26: Consider using ThemeType for consistency.

The mount method uses the literal type 'light' | 'dark' while DevtoolProps uses ThemeType. For consistency and maintainability, consider using ThemeType here as well.

♻️ Suggested change
-    async mount<T extends HTMLElement>(el: T, theme: 'light' | 'dark') {
+    async mount<T extends HTMLElement>(el: T, theme: ThemeType) {

And similarly on line 68:

-    async mount<T extends HTMLElement>(_el: T, _theme: 'light' | 'dark') {}
+    async mount<T extends HTMLElement>(_el: T, _theme: ThemeType) {}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/devtools-utils/src/solid/class.ts` at line 26, The mount method and
its other occurrences use the literal type 'light' | 'dark' instead of the
shared ThemeType; update the signature of async mount<T extends HTMLElement>(el:
T, theme: 'light' | 'dark') to use ThemeType, and replace any other literal
occurrences (e.g., the usage around line 68) with ThemeType so the code
consistently imports and references the same ThemeType used by DevtoolProps
(ensure ThemeType is imported where needed).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/cyan-times-marry.md:
- Line 6: Typo in the changeset description: locate the changeset entry whose
summary reads "Extract devtools-ui from devtools-utils to avoid theme
miss-match" and correct the word "miss-match" to "mismatch" so the summary reads
"Extract devtools-ui from devtools-utils to avoid theme mismatch".

---

Nitpick comments:
In `@packages/devtools-utils/src/solid/class.ts`:
- Line 26: The mount method and its other occurrences use the literal type
'light' | 'dark' instead of the shared ThemeType; update the signature of async
mount<T extends HTMLElement>(el: T, theme: 'light' | 'dark') to use ThemeType,
and replace any other literal occurrences (e.g., the usage around line 68) with
ThemeType so the code consistently imports and references the same ThemeType
used by DevtoolProps (ensure ThemeType is imported where needed).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f526506c-03ef-4c24-94d6-2fabe60212f9

📥 Commits

Reviewing files that changed from the base of the PR and between a120650 and cd63494.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • .changeset/cyan-times-marry.md
  • packages/devtools-ui/src/components/theme.tsx
  • packages/devtools-ui/src/index.ts
  • packages/devtools-ui/src/styles/use-styles.ts
  • packages/devtools-utils/bin/intent.js
  • packages/devtools-utils/package.json
  • packages/devtools-utils/src/solid/class-mount-impl.tsx
  • packages/devtools-utils/src/solid/class.ts

'@tanstack/devtools-ui': patch
---

Extract devtools-ui from devtools-utils to avoid theme miss-match
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Typo in changeset description.

"miss-match" should be "mismatch".

-Extract devtools-ui from devtools-utils to avoid theme miss-match
+Extract devtools-ui from devtools-utils to avoid theme mismatch
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Extract devtools-ui from devtools-utils to avoid theme miss-match
Extract devtools-ui from devtools-utils to avoid theme mismatch
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.changeset/cyan-times-marry.md at line 6, Typo in the changeset description:
locate the changeset entry whose summary reads "Extract devtools-ui from
devtools-utils to avoid theme miss-match" and correct the word "miss-match" to
"mismatch" so the summary reads "Extract devtools-ui from devtools-utils to
avoid theme mismatch".

@harry-whorlow harry-whorlow force-pushed the extract-theme-provider branch from cd63494 to 00179c0 Compare March 14, 2026 19:57
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/devtools-ui/src/components/icons.tsx (1)

44-44: Consider removing commented-out icon implementations.

The file contains several large blocks of commented-out code (lines 44-244, 471-491, 740-888, 889-1755). These appear to be older or alternate implementations of icons that have active versions elsewhere in the file (e.g., List at line 294, ChevronDownIcon at line 572).

If these are no longer needed, consider removing them to reduce file size and improve maintainability. If they're kept intentionally for reference, a brief comment explaining why would help future maintainers.

Also applies to: 471-471, 740-740, 889-889

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/devtools-ui/src/components/icons.tsx` at line 44, This file contains
large blocks of commented-out icon implementations that duplicate active icons
(e.g., List and ChevronDownIcon) and bloat the file; remove the unused
commented-out icon blocks (the large comment ranges around lines containing List
and ChevronDownIcon and other repeats) or, if you intentionally want to keep
them, replace each block with a single short explanatory comment stating why the
old implementation is retained for reference, and ensure any retained comments
reference the active symbol names (e.g., List, ChevronDownIcon) so future
maintainers understand the reason.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/devtools-ui/src/components/icons.tsx`:
- Line 44: This file contains large blocks of commented-out icon implementations
that duplicate active icons (e.g., List and ChevronDownIcon) and bloat the file;
remove the unused commented-out icon blocks (the large comment ranges around
lines containing List and ChevronDownIcon and other repeats) or, if you
intentionally want to keep them, replace each block with a single short
explanatory comment stating why the old implementation is retained for
reference, and ensure any retained comments reference the active symbol names
(e.g., List, ChevronDownIcon) so future maintainers understand the reason.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ed907713-1e8c-4d6c-bf4c-f523acbfdbf8

📥 Commits

Reviewing files that changed from the base of the PR and between 8355776 and 08263f7.

📒 Files selected for processing (8)
  • examples/solid/devtools-ui/src/index.tsx
  • packages/devtools-a11y/src/core/styles/styles.ts
  • packages/devtools-ui/src/components/icons.tsx
  • packages/devtools-utils/package.json
  • packages/devtools/src/index.ts
  • packages/preact-devtools/src/devtools.tsx
  • packages/react-devtools/src/devtools.tsx
  • packages/solid-devtools/src/core.tsx
💤 Files with no reviewable changes (1)
  • packages/devtools-utils/package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant